//
//  vdColor.h
//  Void Dead
//
// Created by Sidney Just on 17.11.09.
//
//  Copyright © 2009 by Sidney Just
//  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
//  documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
//  the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 
//  and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 
//  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
//  PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE 
//  FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
//  ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#import "vdHeader.h"

/**
 * A ARGB color structure.
 * <br> Usefull color functions:
 * <br> void vdColor_byteToFloat(vdColor *aColor); <- Converts the color values (ARGB) from byte (0 to 255) to float (0.0 to 1.0)
 * <br> void vdColor_floatToByte(vdColor *aColor); <- Converts the color values (ARGB) from byte float (0.0 to 1.0) to (0 to 255)
 * <br> BOOL vdColor_equalToColor(vdColor *color1, vdColor *color2); <- Checks if two vdColor structs are equal and returns YES when they are equal, otherwise NO
 **/
typedef struct {
	/**
	 * The alpha channel
	 **/
	GLfloat alpha;
	
	/**
	 * The red channel
	 **/
	GLfloat red;
	
	/**
	 * The green channel
	 **/
	GLfloat green;
	
	/**
	 * The blue channel
	 **/
	GLfloat blue;
} vdColor;

#ifdef __cplusplus
extern "C" {
#endif
	/**
	 * \defgroup Color Color
	 */
	/*@{*/

	/**
	 * Converts the color values (ARGB) from byte (0 to 255) to float (0.0 to 1.0)
	 @param aColor The color that should be converted
	 **/
	void vdColor_byteToFloat(vdColor *aColor);

	/**
	 * Converts the color values (ARGB) from byte float (0.0 to 1.0) to (0 to 255)
	 @param aColor The color that should be converted
	 **/
	void vdColor_floatToByte(vdColor *aColor);

	/**
	 * Checks if two vdColor structs are equal
	 @param color1 First color
	 @param color2 Second color
	 @return YES if the first color and the second color are equal, otherwise NO
	 **/
	BOOL vdColor_equalToColor(vdColor *color1, vdColor *color2);
	
	/**
	 * Creates a new vdColor with the given colors
	 @param alpha Alpha channel
	 @param red Red channel
	 @param green Green channel
	 @param blue Blue channel
	 @return A new vdColor struct with the given colors
	 **/
	static __inline__ vdColor vdColor_create(float alpha, float red, float green, float blue)
	{
		vdColor color; 
		color.alpha	= alpha;
		color.red		= red;
		color.green	= green;
		color.blue		= blue;
		return color;
	}

	/*@}*/
#ifdef __cplusplus
}
#endif	